package com.thread.worker_thread;

import java.util.Random;

/**
 * @author leon(liangzou0318@gmail.com)
 * @date 2012-10-20
 * @filaname ClientThread.java
 */
public class ClientThread extends Thread{
	private final Channel channels;
	Random random =new Random();
	//private final String name;
   public ClientThread(String name,Channel channels){
	   super(name);
	   this.channels=channels;
   }
   public void run(){
	   try{
		   for(int i=0;true;i++){
			   Request request=new Request(getName(),i);
			   channels.putRequest(request);
			   Thread.sleep(random.nextInt(1000));
		   }
	   }
	   catch(InterruptedException e){
	   }
   }
}
